﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.woodsoft.core;
using com.woodsoft.core.Files;
using System.Xml;

namespace EQ1.Elements {
  public class Control : ScreenPiece , IUIElement<Control> {
    public Control ( UIDocument doc , string name )
      : base( doc , name ) {
      this.Style_VScroll = false;
      this.Style_HScroll = false;
      this.Style_AutoVScroll = false;
      this.Style_AutoHScroll = false;
      this.Style_Transparent = false;
      this.Style_TransparentControl = false;
      this.Style_Border = false;
      this.Style_Tooltip = true;

    }
    public Control ( UIDocument doc )
      : this( doc , "Control" ) {
    }

    #region IUIElement<Control> Members

    public void Validate ( Control val , string name ) {
      throw new NotImplementedException();
    }

    public void Copy ( Control val ) {
      base.Copy( val );

      this.Style_VScroll = val.Style_VScroll;
      this.Style_HScroll = val.Style_HScroll;
      this.Style_AutoVScroll = val.Style_AutoVScroll;
      this.Style_AutoHScroll = val.Style_AutoHScroll;
      this.Style_Transparent = val.Style_Transparent;
      this.Style_TransparentControl = val.Style_TransparentControl;
      this.Style_Border = val.Style_Border;
      this.Style_Tooltip = val.Style_Tooltip;

      if( !string.IsNullOrEmpty( val.TooltipReference ) )
        this.TooltipReference = val.TooltipReference;
      if( !string.IsNullOrEmpty( val.EQType ) )
        this.EQType = val.EQType;
      if( !string.IsNullOrEmpty( val.DrawTemplate ) )
        this.DrawTemplate = val.DrawTemplate;
      if( !string.IsNullOrEmpty( val.Layout ) )
        this.Layout = val.Layout;
    }

    #endregion

    public bool Style_VScroll {
      get {
        return bool.Parse( this.GetElement( "Style_VScroll" ).InnerText );
      }
      set {
        this.Validate( "Style_VScroll" , value.ToString() );
      }
    }
    public bool Style_HScroll {
      get {
        return bool.Parse( this.GetElement( "Style_HScroll" ).InnerText );
      }
      set {
        this.Validate( "Style_HScroll" , value.ToString() );
      }
    }
    public bool Style_AutoVScroll {
      get {
        return bool.Parse( this.GetElement( "Style_AutoVScroll" ).InnerText );
      }
      set {
        this.Validate( "Style_AutoVScroll" , value.ToString() );
      }
    }
    public bool Style_AutoHScroll {
      get {
        return bool.Parse( this.GetElement( "Style_AutoHScroll" ).InnerText );
      }
      set {
        this.Validate( "Style_AutoHScroll" , value.ToString() );
      }
    }
    public bool Style_Transparent {
      get {
        return bool.Parse( this.GetElement( "Style_Transparent" ).InnerText );
      }
      set {
        this.Validate( "Style_Transparent" , value.ToString() );
      }
    }
    public bool Style_TransparentControl {
      get {
        return bool.Parse( this.GetElement( "Style_TransparentControl" ).InnerText );
      }
      set {
        this.Validate( "Style_TransparentControl" , value.ToString() );
      }
    }
    public bool Style_Border {
      get {
        return bool.Parse( this.GetElement( "Style_Border" ).InnerText );
      }
      set {
        this.Validate( "Style_Border" , value.ToString() );
      }
    }
    public bool Style_Tooltip {
      get {
        return bool.Parse( this.GetElement( "Style_Tooltip" ).InnerText );
      }
      set {
        this.Validate( "Style_Tooltip" , value.ToString() );
      }
    }
    public string TooltipReference {
      get {
        return this.GetElement( "TooltipReference" ).InnerText;
      }
      set {
        this.Validate( "TooltipReference" , value );
      }
    }
    public string EQType {
      get {
        return this.GetElement( "EQType" ).InnerText;
      }
      set {
        this.Validate( "EQType" , value );
      }
    }
    public string DrawTemplate {
      get {
        return this.GetElement( "DrawTemplate" ).InnerText;
      }
      set {
        this.Validate( "DrawTemplate" , value );
      }
    }
    public string Layout {
      get {
        return this.GetElement( "Layout" ).InnerText;
      }
      set {
        this.Validate( "Layout" , value );
      }
    }
  }
}
